package com.hr.设计模式.单例模式;

/**
 * @author 周恒哲
 * @date 2020/06/17
 * 静态内部类
 **/
public class Singleton3 {
    /**
     * volatile：禁止指令重排，不保证原子性
     */
    private static class SingletonHolder {
        private static final Singleton3 INSTANCE = new Singleton3();
    }

    private Singleton3() {
    }

    public static final Singleton3 getSingleton() {
        return SingletonHolder.INSTANCE;
    }

}
